import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn } from "typeorm"

@Entity({ name: "user" })
export class User {
    @PrimaryGeneratedColumn({
        type: 'int',
        name: 'id',
        comment: '主键id'
    })
    id: number
    @Column('varchar', {
        nullable: false,
        unique: true,
        length: 150,
        name: 'uuid',
        generated: 'uuid',
        comment: 'uuid',
    })
    uuid: string;
    @Column({
        unique: true,
        nullable: false,
        type: 'varchar',
        name: 'username',
        comment: '用户名',
        length: 100
    })
    userName: string
    @Column(
        {
            nullable: false,
            type: 'varchar',
            name: 'password',
            comment: '密码',
        }
    )
    passWord: string
    @Column({
        type: 'tinyint',
        name: 'is_active',
        default: () => 1,
        comment: '是否活跃'
    })
    isActive: number | null
    @Column({
        nullable: true,
        name: 'mobile',
        comment: '手机号',
        length: 11
    })
    mobile: string | null
    @CreateDateColumn(
        {
            type: 'datetime',
            name: 'create_time',
            comment: '创建时间'
        }
    )
    createTime: Date
    @CreateDateColumn(
        {
            type: 'datetime',
            name: 'update_time',
            comment: '更新时间'
        }
    )
    updateTime: Date
}
